<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
	<script src="index.js"></script>
</head>
<body>
<button id="btn">点击</button>
</body>
</html>
<script>
	let btn=document.querySelector("#btn");
	btn.onclick=function () {
		console.log(111)
		let worker=new Worker("index.js");
		worker.onmessage=function (ev) {
			alert(ev.data)
		}
		worker.postMessage("你好")
	}
</script>
